<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="../../../../WEB-INF/myTag.tld" prefix="my"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<title>线索上报</title>
	
    <link href="<%=request.getContextPath()%>/views/sysdefault/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/views/sysdefault/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/views/sysdefault/css/animate.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/views/sysdefault/css/style.min.css?v=4.0.0" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/views/sysdefault/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/views/sysdefault/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">

    <link href="<%=request.getContextPath()%>/views/sysdefault/css/plugins/datapicker/datepicker3.css" rel="stylesheet">

</head>
<body class="gray-bg">
    <!-- 分页 -->
	<form id="pagerForm" method="post" action="listXssb.do">
		<input type="hidden" name="currentPage" id="currentPage" value="1" />
<%-- 		<input type="hidden" name="status" value="${dataStore.status}" /> --%>
	</form>
   <!-- 导出 -->
	<form id="export" method="post" action="xsInfoExport.do">
		<input type="hidden" name="sbr" value="${dataStore.sbr}" />
		<input type="hidden" name="sfzh" value="${dataStore.sfzh}" />
		<input type="hidden" name="sbsj" value="${dataStore.sbsj}" />
		<input type="hidden" name="scr" value="${dataStore.scr}" />
		<input type="hidden" name="status" value="${dataStore.status}" />
	</form>
    <div class="wrapper wrapper-content animated fadeInRight">
    	<div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>线索上报</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                    
                    	<!-- 搜索区 -->
                    	<div class="m-b-sm">
                    
                    		<form id="newsList" name="newsList" action="listXssb.do" method="post">
                    		
                    			 <div class="col-lg-2 m-b-sm">
                    				<div class="input-group">
                    					<span class="input-group-addon">上报人姓名:</span>
										<input type="text" class="form-control" name="sbr" id="sbr" value="${dataStore.sbr}"/>
									</div>
								</div>
									
								<div class="col-lg-2 m-b-sm">
                    				<div class="input-group">
                    					<span class="input-group-addon">上报人身份证:</span>
										<input type="text" class="form-control" name="sfzh" id="sfzh" value="${dataStore.sfzh}"/>
									</div>
								</div>
								
                    			<div class="col-lg-2 m-b-sm">
                    				<div class="input-group">
                    					<span class="input-group-addon">审查人:</span>
										<input type="text" class="form-control" name="scr" id="scr" value="${dataStore.scr}"/>
									</div>
								</div>
                    		
                    			<div class="m-b-sm">
									<div class="col-lg-2">
										<div class="input-group">
											<span class="input-group-addon">审查状态:</span>
												<select name="status" class="form-control">
													<option value="">所有状态</option>
													<option value="0" <c:if test="${dataStore.status == '0'}">selected="selected"</c:if> >未处理</option>
													<option value="1" <c:if test="${dataStore.status == '1'}">selected="selected"</c:if> >审查通过</option>
													<option value="2" <c:if test="${dataStore.status == '2'}">selected="selected"</c:if> >审查拒绝</option>
												</select>
										</div>
									</div>
								</div>
                      			  <div class="col-lg-3" id="data_5">
                            		<div class="input-daterange input-group" id="datepicker">
                            			<span class="input-group-addon input-title">上报日期:</span>
                              		  		<input type="text" class="form-control" name="start" value="${dataStore.start}" />
                               			 <span class="input-group-addon">至</span>
                               				 <input type="text" class="form-control" name="end" value="${dataStore.end}" />
                           		 	</div>
                    			</div>                  	
                  	
                    			<button type="submit" id="search" class="btn btn-info" ><i class="fa fa-search"></i>&nbsp;&nbsp;搜索</button>
                    		</form>
                    	</div>
                    	
                    	<div class="m-b-sm">
                    		<button type="button" class="btn btn-danger btn-sm" onclick="delXs();"><i class="fa fa-times-circle"></i>&nbsp;&nbsp;删除</button>
                    		<button type="button" class="btn btn-success btn-sm" onclick="output();"><i class="fa fa-plus-circle"></i>&nbsp;&nbsp;导出</button>
							<button type="button" class="btn btn-success btn-sm" onclick="input();"><i class="fa fa-plus-circle"></i>&nbsp;&nbsp;导入</button>
                    	</div>
                    	
						<!-- 列表区 -->
						<div class="m-b-sm">
							<table id="table" data-toggle="table" data-striped="true" >
								<thead>
									<tr>
										<th data-checkbox="true" data-width="2%"></th>
										<th data-visible="false">id</th>
										<th data-width="3%" data-align="center">序号</th>
										<th data-width="10%">相关图片</th>
										<th data-width="6%">相关文件</th>
										<th data-width="15%">内容</th>
										<th data-width="8%">审查状态</th>
										<th data-width="10%">上报人号码</th>
										<th data-width="10%">上报时间</th>
										<th data-width="5%">审查人</th>
										<th data-width="10%">审查时间</th>
										<th data-width="9%" data-align="center">操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${pageInfo.resultList}" var="item" varStatus="i">
										<tr>
											<td></td>
											<td>${item.xsid}</td>
											<td>${i.index + 1}</td>
											<td><img width="120px" height="80px" src="${item.tplj}" /></td>
											<td>${item.wjlj}</td>
											<td>${item.xsnr}</td>
											<td>
											<c:choose>
												<c:when test="${item.zt == '0'}">未处理</c:when>
												<c:when test="${item.zt == '1'}">审查通过</c:when>
												<c:when test="${item.zt == '2'}">审查拒绝</c:when>
												<c:otherwise>未知状态</c:otherwise>
											</c:choose>
											</td>
											<td>${item.sjh}</td>
											<td><my:DateSubString date="${item.sbsj}" subNum="16"/></td>
											<td>${item.scr}</td>
											<td><my:DateSubString date="${item.scsj}" subNum="16"/></td>
											<td>
												<button type="button" class="btn btn-primary btn-xs" onclick="detail('${item.xsid}');">详情</button>
												<button type="button" class="btn btn-success btn-xs" onclick="edit('${item.xsid}');">编辑</button>
												<c:if test="${item.zt =='0'}">
													<button type="button" class="btn btn-success btn-xs" onclick="auditing('${item.xsid}');">审核</button>
												</c:if>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>

						<jsp:include page="../../common/turnPage.jsp" />
					</div>
                </div>
            </div>
            
        </div>

	</div>
    
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/jquery.min.js?v=2.1.4"></script>
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/content.min.js?v=1.0.0"></script>
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/toastr/toastr.min.js"></script>
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/layer/layer.js"></script>
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/bootstrap-table/bootstrap-table.js"></script>
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    
    <script src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    
    <script type="text/javascript">
    
    var basePath = '<%=request.getContextPath()%>';
    
    toastr.options = {
  		  "closeButton": true,
  		  "debug": false,
  		  "progressBar": true,
  		  "positionClass": "toast-top-left",
  		  "showDuration": "400",
  		  "hideDuration": "1000",
  		  "timeOut": "3000",
  		  "extendedTimeOut": "1000",
  		  "showEasing": "swing",
  		  "hideEasing": "linear",
  		  "showMethod": "fadeIn",
  		  "hideMethod": "fadeOut"
  		}
       
    //初始化日期控件
    $("#data_5 .input-daterange").datepicker({
        keyboardNavigation: !1,
        forceParse: !1,
        autoclose: !0
    });
    
    //添加线索
    var add = function(){
    	location.href="editXssbLogin.do?rlqbXssb="+xsid;
    }
	 //删除线索
    var delXs = function(){
		var selectIds = '';
		
		var selectItems = $("#table").bootstrapTable('getSelections');
		$.each(selectItems, function(i, item){
			selectIds = selectIds + item[1] + ',';
		});
		
		if(selectIds == ''){
			toastr.warning("请选择需要删除的线索信息！", "提示");
			return;
		}
		
		layer.confirm('确定要删除选中的线索信息吗？', {
			  btn: ['确定','取消'] //按钮
			}, function(index){
			  
				layer.close(index);
				
				$.ajax({
					type : "POST",
					url : basePath + "/rlqb/delXs.do",
					data : {"xsId" : selectIds},
					dataType : "json",
					success : function(msg) { 
						debugger;
						if (msg.errCode == '1') {
							
							layerCallBack('1');
						}else{
							toastr.error(msg.errMsg, "提示");
						}
					},
					error : function(XMLHttpRequest, textStatus, errorThrown) {
						debugger;
						toastr.error("系统出错！", "提示");
					},
					beforeSend : function(XMLHttpRequest){
						layer.load(0, {
							  shade: [0.3,'#ccc'] //0.1透明度的白色背景
							});
					},
					complete : function(XMLHttpRequest, textStatus){
						layer.closeAll();
					}
				});
				
			}, function(){
			  
			});
		
	}
    function edit(xsid){
    	debugger;
    	layer.open({
    		  type: 2,
    		  title: '编辑上报内容',
    		  shadeClose: true,
    		  shade: 0.3,
    		  area: ['800px', '650px'],
    		  content: basePath + '/rlqb/editXssb.do?xsId='+xsid
    		  //iframe的url
    		});
    }
    function detail(xsid){
    	debugger;
    	layer.open({
    		  type: 2,
    		  title: '上报信息详细',
    		  shadeClose: true,
    		  shade: 0.3,
    		  area: ['800px', '580px'],
    		  content: basePath + '/rlqb/xssbDetail.do?xsId='+xsid
    		  //iframe的url
    		});
    }
    function auditing(xsid){
    	debugger;
    	layer.open({
    		  type: 2,
    		  title: '上报信息审核',
    		  shadeClose: true,
    		  shade: 0.3,
    		  area: ['800px', '650px'],
    		  content: basePath + '/rlqb/auditingXssb.do?xsId='+xsid
    		  //iframe的url
    		});
    }
    
  //导出
    var output = function(){
    	debugger;
    	layer.confirm('确定要导出数据吗？', {
			  btn: ['确定','取消'] //按钮
			}, function(index){
			  
				layer.close(index);
				debugger;
				$("#export").submit();
				
			}, function(){
			  
			});
    	
    }
    
    //导入
    var input = function(){
    	layer.open({
  		  type: 2,
  		  title: '本地线索信息导入',
  		  shadeClose: true,
  		  shade: 0.3,
  		  area: ['800px', '250px'],
  		  content: basePath + '/rlqb/xsInfoImportLogin.do' //iframe的url
  		});
    }
    
    //操作成功
    var layerCallBack = function(status){
    	if(status == '1'){
    		layer.closeAll();
    		toastr.success("操作成功！", "提示");
    		
    		setTimeout(function(){
    			location.reload();
    		}, 1000);
    		
    	}else if(status == '2'){
    		layer.closeAll();
    		toastr.success("操作成功！", "提示");
    	}
    }
    
    </script>
    
</body>
</html>